package com.sk.gzwater.adapter;

import java.util.HashMap;
import java.util.List;
import com.sk.gzewop.R;
import android.content.Context;
import android.database.DataSetObserver;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListAdapter;
import android.widget.TextView;

public class ShujutianbaoWeiwanchengRenwuDatalistAdapter implements ListAdapter {
	private Context context;
	private List<HashMap<String, String>> dataList;
	public ShujutianbaoWeiwanchengRenwuDatalistAdapter (Context context,List<HashMap<String, String>> dataList){
		this.context = context;
		this.dataList = dataList;
	}
	
	@Override
	public void registerDataSetObserver(DataSetObserver observer) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void unregisterDataSetObserver(DataSetObserver observer) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return dataList.size();
	}

	@Override
	public HashMap<String, String> getItem(int position) {
		// TODO Auto-generated method stub
		return dataList.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public boolean hasStableIds() {
		// TODO Auto-generated method stub
		return true;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View view = convertView;
		view = LayoutInflater.from(context).inflate(R.layout.shujutianbaoweiwanchengrenwu_data_item, null);
		if (position%2!=1) {
			view.setBackgroundResource(R.color.white);
		}else {
			view.setBackgroundResource(R.color.gray);
		}
		TextView date = (TextView)view.findViewById(R.id.shujutianbaoweiwanchengrenwu_item_date);
		TextView kind = (TextView)view.findViewById(R.id.shujutianbaoweiwanchengrenwu_item_kind);
		TextView statu = (TextView)view.findViewById(R.id.shujutianbaoweiwanchengrenwu_item_statu);
		date.setText(getItem(position).get("date"));
		kind.setText(getItem(position).get("kind"));
		statu.setText(getItem(position).get("statu"));
		return view;
	}

	@Override
	public int getItemViewType(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int getViewTypeCount() {
		// TODO Auto-generated method stub
		return 1;
	}

	@Override
	public boolean isEmpty() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean areAllItemsEnabled() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean isEnabled(int position) {
		// TODO Auto-generated method stub
		return false;
	}

}
